Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dev-server): configure request proxy for dev-server #1299

Merged
merged 7 commits into from
Jul 10, 2024

Conversation

tthvo
Copy link
Member

@tthvo tthvo commented Jul 10, 2024

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Fixes: cryostatio/cryostat#328
Related to cryostatio/cryostat#327

Description of the change:

  • Configure dev-server to proxy API requests to Cryostat and Grafana.

Motivation for the change:

This should allow development of web without having to rebuild the container image all the time. I think this is a bit simpler than handling CORS.

This idea comes from the fact that Grafana proxies its client's requests to jfr-datasource so I guess dev-server can do the same. What do you think @andrewazores?

References

https://webpack.js.org/configuration/dev-server/#devserverproxy

@tthvo tthvo added feat New feature or request safe-to-test labels Jul 10, 2024
@tthvo tthvo requested review from andrewazores and a team July 10, 2024 08:02
@github-actions github-actions bot added the needs-triage Needs thorough attention from code reviewers label Jul 10, 2024
@tthvo tthvo removed the needs-triage Needs thorough attention from code reviewers label Jul 10, 2024
@andrewazores
Copy link
Member

Great idea, I didn't know the devserver had such an ability. This is definitely easier than dealing with CORS.

@andrewazores
Copy link
Member

Seems like some paths are constructed incorrectly and this setup exposes the flaws:

Screenshot_2024-07-10_09-50-57

Notice the double // at the beginning of the request path: http://localhost:9000//api/v3/targets/2/reports/3. This is when expanding an active recording row to view the automated analysis report.

Similar problem occurs for archived recordings' reports:

Screenshot_2024-07-10_09-52-40

@tthvo
Copy link
Member Author

tthvo commented Jul 10, 2024

Notice the double // at the beginning of the request path: http://localhost:9000//api/v3/targets/2/reports/3. This is when expanding an active recording row to view the automated analysis report.

Nice thanks for catching that! I fixed the URL construct for that now. It should work as expected.

image

@tthvo
Copy link
Member Author

tthvo commented Jul 10, 2024

In the 2 latest commits, I added some changes that ensure dev-server work with cryostat over https: cryostatio/cryostat#426.

README.md Outdated Show resolved Hide resolved
@andrewazores andrewazores merged commit 7c0824c into cryostatio:main Jul 10, 2024
18 checks passed
@tthvo tthvo deleted the dev-server-proxy branch July 10, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Request] CORS handling for development
2 participants